package com.example.demo.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 蔡定努
 * 2025/05/30 10:58
 */
@Slf4j
@Service
public class NotificationFacadeService {

    @Async // 添加异步注解，提升性能
    @TransactionalEventListener
    public void on(OrderCreated orderCreated) {
        log.info("收到事件： order created event: {}", orderCreated);
    }
}
